package com.example.cinema.bindingdata;

import android.util.Log;
import android.view.View;
import android.widget.ImageView;

import androidx.databinding.BindingAdapter;
import androidx.databinding.ObservableField;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.example.cinema.R;

//作品数据
public class UserWorksData {

    @BindingAdapter("worksimg")
    public static void WorksimgUrl(View view,String url)
    {
        Log.i("UUU","封面地址"+url);
        if(url==null)
        {
            Glide.with(view).load(view.getContext().getDrawable(R.mipmap.shza)).into((ImageView) view);
            return;
        }
        RequestOptions options = new RequestOptions()
                .placeholder(R.mipmap.defaut_img)
                .error(R.mipmap.defaut_img)
                .fallback(R.mipmap.defaut_img);
        Glide.with(view).load(url)
                .apply(options)
                .into((ImageView) view);
    }


    public ObservableField<Integer> filestate = new ObservableField<>();//作品状态
    public ObservableField<String> fileurls  = new ObservableField<>();//作品播放地址
    public ObservableField<String> fileimage = new ObservableField<>();//作品封面图
    public ObservableField<String> filezan   = new ObservableField<>();//作品点赞数

}
